#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <stdio.h>

#include "plplot.h"
#include "plplotP.h"

int main(int argc, char **argv)
{
    plsdev("xwin");
	plspage(0,0,1000,800,10,100);
    plinit();
    PLFLT **z;
    int nx = 7;
    int ny = 7;
    plAlloc2dGrid(&z, nx, ny);



    //plenv(0.,2.*M_PI, 0, 3.*M_PI,1,-1);
    plcol0(2);
    plenv(0., nx, 0., ny, 1, 0.);



    for (int i=0; i < nx; i++)
        z[i][ny-1] = 1.;    // right
    for (int i=0; i < nx; i++)
        z[i][0] = 1.;       // left
    for (int i=0; i < ny; i++)
        z[0][i] = 1.;       // top
    for (int i=0; i < ny; i++)
        z[nx-1][i] = 1.;    // bottom

    int xmin = 0;
    int xmax = nx;
    int ymin = 0;
    int ymax = ny;
    int zmin = 0;
    int zmax = 5;


	plimage(z,
			(PLINT) nx,   (PLINT) ny,
			(PLFLT) xmin, (PLFLT) xmax,
			(PLFLT) ymin, (PLFLT) ymax,
			(PLFLT) zmin, (PLFLT) zmax,
			(PLFLT) xmin, (PLFLT) xmax,
			(PLFLT) ymin, (PLFLT) ymax);


    plFree2dGrid(z, nx, ny);   
    plend();

    return(0);
}
